//-----------------------------------------------------------------------------
//  Copyright (C) 2005-2008 Thomas S. Ullrich 
//
//  This file is part of the Solitaire Mahjong project.
//
//  This file may be used under the terms of the GNU General Public License.
//  This project is free software; you can redistribute it and/or modify it
//  under the terms of the GNU General Public License.
//  
//  Author: Thomas S. Ullrich
//  Last update: June 1, 2007
//-----------------------------------------------------------------------------
#ifndef smHighscoreEntry_h
#define smHighscoreEntry_h
 
#include <ctime>
#include <functional>
#include <iostream>
#include <QString>
using namespace std;
 
class smHighscoreEntry
{
public:
    smHighscoreEntry();
    smHighscoreEntry(time_t, time_t, unsigned int, unsigned int, unsigned int);
     
    time_t  deltaTime() const;
    QString date() const;
    QString tiles() const;
    QString hints() const;
    QString undos() const;
    QString duration() const;
    bool isValid() const;
     
    time_t startTime() const;
    time_t endTime() const;
    unsigned int tilesLeft() const;
    unsigned int hintsUsed() const;
    unsigned int undosUsed() const;
     
protected:
    time_t       mStartTime;
    time_t       mEndTime;
    unsigned int mTiles;
    unsigned int mHints;
    unsigned int mUndos;
    friend class smHighscoreEntryCompare;
    friend ostream& operator<<(ostream&, const smHighscoreEntry&);
};
 
ostream& operator<<(ostream&, const smHighscoreEntry&);
 
class smHighscoreEntryCompare : public binary_function<smHighscoreEntry, smHighscoreEntry, bool>
{
public:
    bool operator()(smHighscoreEntry, smHighscoreEntry) const;
};
 
inline time_t smHighscoreEntry::startTime() const {return mStartTime;}
inline time_t smHighscoreEntry::endTime() const {return mEndTime;}
inline unsigned int smHighscoreEntry::tilesLeft() const {return mTiles;}
inline unsigned int smHighscoreEntry::hintsUsed() const {return mHints;}
inline unsigned int smHighscoreEntry::undosUsed() const {return mUndos;}
 
#endif
